<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>话题列表(分页)</title>
    <style type="text/css">
        a{
            text-decoration: none;
            display: inline-block;
            border: 1px solid #333333;
            font-size: 10px;
            padding: 5px;
        }
    </style>
</head>

<body>

<h6>总记录数: {{topic_count}}</h6>
<hr>
<table border="1">
    <tr>
        <td>序号</td>
        <td>标题</td>
        <td>话题内容</td>
        <td>创建日期</td>
    </tr>
    {% for topic in topics %}
    <tr>
        <td>{{forloop.counter}}</td>
        <td>{{topic.title}}</td>
        <td>{{topic.content}}</td>
        <td>{{topic.created_time}}</td>
    </tr>
    {% empty %}
    <tr>
        <td colspan="4">没有记录返回</td>
    </tr>
    {% endfor %}
</table>
<hr>
<!--分页功能-->
<div class="pagination">
    <span class="step-links">
        {% if topics.has_previous %}
            <a href="{% url 'topic_list_page' 1 %}">首页</a>
            <a href="{% url 'topic_list_page' topics.previous_page_number %}">上一页</a>
        {% endif %}
        <span>
            第{{topics.number}}页/共{{topics.paginator.num_pages}}页
        </span>
        {% if topics.has_next %}
            <a href="/post/topic_list_page/{{topics.next_page_number}}">下一页</a>
            <a href="/post/topic_list_page/{{topics.paginator.num_pages}}">末页</a>
        {% endif %}

    </span>
</div>

</body>
</html>